import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class StartInit implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        ServletContext servletContext = servletContextEvent.getServletContext();
        System.out.println("WyxServletContextListener 监听到 " +
                servletContext + " 被创建..");
        //如果我们获取到ServletContext 对象..进行业务处理

    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        ServletContext servletContext = servletContextEvent.getServletContext();
        System.out.println("WyxServletContextListener 监听到 " +
                servletContext + " 被销毁..");

        //比如可以对servletContext 数据进行处理， 或者日志的管理...
        System.out.println("进行处理工作.....");
    }
}
